/**
 * 项目名：phms3
 * 日期：    2019-11-23 11:17:06
 * Copyright (c) 2015- HTSC-版权所有
 */

package com.joysuch.wwyt.core.entity;

import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;

import static javax.persistence.GenerationType.IDENTITY;

@EntityListeners({ AuditingEntityListener.class, AutoSetCommonFieldListener.class })
@Entity
@Table(name = "WWYT_BASE_ATTACHMENT_REPO")
@SQLDelete(sql = "update WWYT_BASE_ATTACHMENT_REPO set DELETE_FLAG = '1' where id= ?")
@SQLDeleteAll(sql = "update WWYT_BASE_ATTACHMENT_REPO set DELETE_FLAG = '1' where id= ?")
@Where(clause = "DELETE_FLAG = '0'")
public class BaseAttachmentRepo implements java.io.Serializable {

    // columns START
    // ID
    private java.lang.Long id;
    // 名称
    private java.lang.String name;
    // 租户
    private java.lang.Long tenentId;
    // 文件路径
    private java.lang.String path;
    // 类型
    private java.lang.String type;
    // 文件名称
    private java.lang.String fileName;
    // 下载次数
    private java.lang.Integer downloadCount;
    // 文件大小
    private java.lang.Integer fileSize;
    // 删除标记
    private java.lang.String deleteFlag;
    // 组织机构代码
    private java.lang.String orgCode;
    // columns END
    // 指纹
    private String fingerPrint;
    // 需要转换
    private String needConvert;
    // 转换格式
    private String convertFormat;
    // 转换状态
    private Integer convertState;
    // 转换文件路径
    private String convertPath;
    // 转换开始时间
    private Date convertStartTime;
    // 转换结束时间
    private Date convertEndTime;
    // 封面图片ID
    private Long coverImgId;
    // 转换后文件大小
    private Integer convertFileSize;
    // 转换后文件页数
    private Integer convertFilePages;

    //文件完整性标识
    private Integer integrity;
    //pdf转换失败重试次数
    private Integer retryCount;

    public Integer getRetryCount() {
        return retryCount;
    }

    public void setRetryCount(Integer retryCount) {
        this.retryCount = retryCount;
    }

    @Column(name = "FINGER_PRINT", length = 64)
    public String getFingerPrint() {
        return fingerPrint;
    }

    public void setFingerPrint(String fingerPrint) {
        this.fingerPrint = fingerPrint;
    }

    @Column(name = "NEED_CONVERT", length = 1)
    public String getNeedConvert() {
        return needConvert;
    }

    public void setNeedConvert(String needConvert) {
        this.needConvert = needConvert;
    }

    @Column(name = "CONVERT_FORMAT", length = 10)
    public String getConvertFormat() {
        return convertFormat;
    }

    public void setConvertFormat(String convertFormat) {
        this.convertFormat = convertFormat;
    }

    @Column(name = "CONVERT_STATE")
    public Integer getConvertState() {
        return convertState;
    }

    public void setConvertState(Integer convertState) {
        this.convertState = convertState;
    }

    @Column(name = "CONVERT_PATH", length = 255)
    public String getConvertPath() {
        return convertPath;
    }

    public void setConvertPath(String convertPath) {
        this.convertPath = convertPath;
    }

    @Column(name = "CONVERT_START_TIME")
    public Date getConvertStartTime() {
        return convertStartTime;
    }

    public void setConvertStartTime(Date convertStartTime) {
        this.convertStartTime = convertStartTime;
    }

    @Column(name = "CONVERT_END_TIME")
    public Date getConvertEndTime() {
        return convertEndTime;
    }

    public void setConvertEndTime(Date convertEndTime) {
        this.convertEndTime = convertEndTime;
    }

    @Column(name = "COVER_IMG_ID")
    public Long getCoverImgId() {
        return coverImgId;
    }

    public void setCoverImgId(Long coverImgId) {
        this.coverImgId = coverImgId;
    }

    @Column(name = "CONVERT_FILE_SIZE")
    public Integer getConvertFileSize() {
        return convertFileSize;
    }

    public void setConvertFileSize(Integer convertFileSize) {
        this.convertFileSize = convertFileSize;
    }

    @Column(name = "CONVERT_FILE_PAGES")
    public Integer getConvertFilePages() {
        return convertFilePages;
    }

    public void setConvertFilePages(Integer convertFilePages) {
        this.convertFilePages = convertFilePages;
    }

    public void setId(java.lang.Long value) {
        this.id = value;
    }

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "Id", unique = true, nullable = false)
    public java.lang.Long getId() {
        return this.id;
    }

    @Column(name = "NAME", length = 50)
    public java.lang.String getName() {
        return this.name;
    }

    public void setName(java.lang.String value) {
        this.name = value;
    }

    @Column(name = "TENENT_ID")
    public java.lang.Long getTenentId() {
        return this.tenentId;
    }

    public void setTenentId(java.lang.Long value) {
        this.tenentId = value;
    }

    @Column(name = "PATH", length = 255)
    public java.lang.String getPath() {
        return this.path;
    }

    public void setPath(java.lang.String value) {
        this.path = value;
    }

    @Column(name = "TYPE", length = 10)
    public java.lang.String getType() {
        return this.type;
    }

    public void setType(java.lang.String value) {
        this.type = value;
    }

    @Column(name = "FILE_NAME", length = 255)
    public java.lang.String getFileName() {
        return this.fileName;
    }

    public void setFileName(java.lang.String value) {
        this.fileName = value;
    }

    @Column(name = "DOWNLOAD_COUNT")
    public java.lang.Integer getDownloadCount() {
        return this.downloadCount;
    }

    public void setDownloadCount(java.lang.Integer value) {
        this.downloadCount = value;
    }

    @Column(name = "FILE_SIZE")
    public java.lang.Integer getFileSize() {
        return this.fileSize;
    }

    public void setFileSize(java.lang.Integer value) {
        this.fileSize = value;
    }

    @Column(name = "DELETE_FLAG", length = 2)
    public java.lang.String getDeleteFlag() {
        return this.deleteFlag;
    }

    public void setDeleteFlag(java.lang.String value) {
        this.deleteFlag = value;
    }

    @Column(name = "ORG_CODE", length = 100)
    public java.lang.String getOrgCode() {
        return this.orgCode;
    }

    public void setOrgCode(java.lang.String value) {
        this.orgCode = value;
    }

    @Column(name = "INTEGRITY")
    public java.lang.Integer getIntegrity() {
        return this.integrity;
    }

    public void setIntegrity(java.lang.Integer value) {
        this.integrity = value;
    }

    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("id", getId()).append("name", getName())
                .append("tenentId", getTenentId()).append("path", getPath()).append("type", getType())
                .append("fileName", getFileName()).append("downloadCount", getDownloadCount())
                .append("fileSize", getFileSize()).append("deleteFlag", getDeleteFlag()).append("orgCode", getOrgCode())
                .toString();
    }

    public int hashCode() {
        return new HashCodeBuilder().append(getId()).toHashCode();
    }

    public boolean equals(Object obj) {
        if (obj instanceof BaseAttachmentRepo == false)
            return false;
        if (this == obj)
            return true;
        BaseAttachmentRepo other = (BaseAttachmentRepo) obj;
        return new EqualsBuilder().append(getId(), other.getId()).isEquals();
    }
}
